<template>
  <el-row class="panel-group">
    <el-col :xs="12" :sm="12" :lg="{span: '4-8'}"
            class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
        <div class="card-panel-icon-wrapper icon-people" style="padding:0">
          <svg-icon icon-class="yonghushuliang" class-name="card-panel-icon" />
          <!-- <el-image
            :src="require('@/framework/assets/usernum.png')"
            fit="fill"
          /> -->
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            系统用户
          </div>
          <CountTo :start-val="0" :end-val="countData.userCount" :duration="2600"
                   class="card-panel-num" />个
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="{span: '4-8'}"
            class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('messages')">
        <div class="card-panel-icon-wrapper icon-message">
          <svg-icon icon-class="zuzhijigou" class-name="card-panel-icon" />
          <!-- <el-image
            :src="require('@/framework/assets/zuzhi.png')"
            fit="fill"
          /> -->
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            组织机构数量
          </div>
          <CountTo :start-val="0" :end-val="countData.orgCount" :duration="3000"
                   class="card-panel-num" />个
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="{span: '4-8'}"
            class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('purchases')">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="juesenum" class-name="card-panel-icon" />
          <!-- <el-image
            :src="require('@/framework/assets/juese.png')"
            fit="fill"
          /> -->
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            平台角色数量
          </div>
          <CountTo :start-val="0" :end-val="countData.roleCount" :duration="3200"
                   class="card-panel-num" />个
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="{span: '4-8'}"
            class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="menunum" class-name="card-panel-icon" />
          <!-- <el-image
            :src="require('@/framework/assets/menunum.png')"
            fit="fill"
          /> -->
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            平台菜单数量
          </div>
          <CountTo :start-val="0" :end-val="countData.menuCount" :duration="3600"
                   class="card-panel-num" />个
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="{span: '4-8'}"
            class="card-panel-col">
      <div class="card-panel" style="border-right:none" @click="handleSetLineChartData('shoppings')">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="jinrifangwen" class-name="card-panel-icon" />
          <!-- <el-image
            :src="require('@/framework/assets/pingtai.png')"
            fit="fill"
          /> -->
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            平台近日访问量
          </div>
          <CountTo :start-val="0" :end-val="13600" :duration="3600"
                   class="card-panel-num" />个
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
// import { getHomePageCountByUser } from '@/framework/api/dashboard'

export default {
  components: {
    CountTo
  },
  data() {
    return {
      countData: {}
    }
  },
  created() {
    this.getCountByUser()
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    getCountByUser() {
      // getHomePageCountByUser().then(resp => {
      //   this.countData = resp.data
      // })
    }

  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  padding: 16px 0;
  border-top: 1px solid #F2F3F5;
  border-bottom: 1px solid #F2F3F5;

  .card-panel-col {
    // margin-bottom: 32px;
    padding: 0!important;
  }

  .card-panel {
    height: 46px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    display: flex;
    border-right: 1px solid #F2F3F5;
    // box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    // border-color: rgba(0, 0, 0, .05);
    // &:hover {
    //   .card-panel-icon-wrapper {
    //     color: #fff;
    //   }

    //   .icon-people {
    //     background: #40c9c6;
    //   }

    //   .icon-message {
    //     background: #36a3f7;
    //   }

    //   .icon-money {
    //     background: #f4516c;
    //   }

    //   .icon-shopping {
    //     background: #34bfa3
    //   }
    // }

    // .icon-people {
    //   color: #40c9c6;
    // }

    // .icon-message {
    //   color: #36a3f7;
    // }

    // .icon-money {
    //   color: #f4516c;
    // }

    // .icon-shopping {
    //   color: #34bfa3
    // }

    .card-panel-icon-wrapper {
      padding-left: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
      display: flex;
      align-items: center;
      .el-image{
        width: 42px;
        height: 42px;
      }
      // &:first{
      //   padding-left: 0;
      // }
      // &:last{
      //   border-right:none;
      // }
    }

    .card-panel-icon {
      font-size: 42px;
    }

    .card-panel-description {
      margin-left: 16px;
      .card-panel-text {
        white-space: nowrap;
      font-size: 14px;
      font-weight: 400;
      color: #606266;
      line-height: 20px;
        margin-bottom: 2px;
      }
      .card-panel-num {
        font-size: 18px;
        font-weight: bold;
        color: #1D2129;
      }
    }
  }
}
.el-col-lg-4-8 {
		width: 20%;
	}
@media (max-width:1024px) {
 .panel-group .card-panel {
    display: block;
    height: 120px;
  }
  .panel-group .card-panel .card-panel-icon-wrapper{
 width: 30%;
  }
  .card-panel-description {
  margin: 0!important;
  }
.panel-group .card-panel-col{
  width: 33%!important;
  text-align: center;
}
.panel-group .card-panel .card-panel-icon-wrapper{
    width: 100%!important;
}
  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    // height: 100%;
    margin: 0 !important;
    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
